﻿<%@ Page Title="Planning" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Releases.aspx.cs" Inherits="APMAWebConsole.PlanningPart.Releases" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Releases
    </h2>

    <asp:Button ID="btnAddRelease" runat="server" Text="Add Release" OnCommand="OnButtonCommand" CommandName="Add"/>
    <asp:Button ID="btnRemoveRelease" runat="server" Text="Remove Release" OnCommand="OnButtonCommand" CommandName="Remove" Visible="false"/>
    <asp:Button ID="btnEditRelease" runat="server" Text="Edit Release" OnCommand="OnButtonCommand" CommandName="Edit" Visible="false"/>
    <asp:Button ID="btnViewRelease" runat="server" Text="View Release" OnCommand="OnButtonCommand" CommandName="View" Visible="false"/>
    <asp:Button ID="btnBackToList" runat="server" Text="Back to Release List" OnCommand="OnButtonCommand" CommandName="BackToList" CausesValidation="False"/>
        
    <div id="divReleasesGrid" runat="server">
        <p>
            <asp:Label ID="lblSelectedRelease" runat="server" AssociatedControlID="txtSelectedRelease" Text="Selected Release ID:" Visible="false"/>
            <asp:TextBox ID="txtSelectedRelease" runat="server" CssClass="textEntry" Text="0" Visible="false"/>
        </p>
        <asp:GridView ID="grdReleases" runat="server" AutoGenerateColumns="false">
            <columns>
                <asp:BoundField HeaderText="ID" DataField="Id" />
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnEdit" runat="server" CausesValidation="false" Text="Edit" OnCommand="OnButtonCommand" CommandName="Select" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnView" runat="server" CausesValidation="false" Text="View" OnCommand="OnButtonCommand" CommandName="View" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnRemove" runat="server" CausesValidation="false" Text="X" OnCommand="OnButtonCommand" CommandName="Remove" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField HeaderText="Project" DataField="Project" />
                <asp:BoundField HeaderText="Start Date" DataField="Start_date" />
                <asp:BoundField HeaderText="End Date" DataField="End_date" />
                <asp:BoundField HeaderText="State" DataField="State" />
                <asp:BoundField HeaderText="Plan Estimate" DataField="Plan_Estimate" />
            </columns>
        </asp:GridView>
    </div>
        
    <div id="divEditMode" runat="server">
        <p>
            <asp:Label ID="lblReleaseId" runat="server" AssociatedControlID="txtReleaseId">ID:</asp:Label>
            <asp:TextBox ID="txtReleaseId" runat="server" CssClass="textEntry"></asp:TextBox>
        </p>
        <p>
            <asp:Label ID="lblReleaseProjectId" runat="server" AssociatedControlID="ddlReleaseProjectId">Project:</asp:Label>
            <asp:DropDownList ID="ddlReleaseProjectId" runat="server" />
            <asp:RequiredFieldValidator id="rfvReleaseProjectId" runat="server"
                                        ControlToValidate="ddlReleaseProjectId"
                                        ErrorMessage=" * Release Project is a required field."
                                        ForeColor="Red"/>
        </p>
        <p>
            <asp:Label ID="lblReleaseStartDate" runat="server" AssociatedControlID="txtReleaseStartDate">Start Date:</asp:Label>
            <asp:TextBox ID="txtReleaseStartDate" runat="server" />
            <asp:RequiredFieldValidator id="rfvReleaseStartDate" runat="server"
                                        ControlToValidate="txtReleaseStartDate"
                                        ErrorMessage=" * Release Start Date is a required field."
                                        ForeColor="Red"/>
            <br/>
            <asp:CompareValidator id="cvReleaseStartDate" runat="server" Type="Date" Operator="DataTypeCheck" 
            ControlToValidate="txtReleaseStartDate" ErrorMessage="Please enter a valid date.">
            </asp:CompareValidator>
        </p>
        <p>
            <asp:Label ID="lblReleaseEndDate" runat="server" AssociatedControlID="txtReleaseEndDate">End Date:</asp:Label>
            <asp:TextBox ID="txtReleaseEndDate" runat="server" />
            <br/>
            <asp:CompareValidator id="cvReleaseEndDate" runat="server" Type="Date" Operator="DataTypeCheck" 
            ControlToValidate="txtReleaseEndDate" ErrorMessage="Please enter a valid date.">
            </asp:CompareValidator>
        </p>
        <p>
            <asp:Label ID="lblReleaseStateId" runat="server" AssociatedControlID="ddlReleaseStateId">State:</asp:Label>
            <asp:DropDownList ID="ddlReleaseStateId" runat="server" />
            <asp:RequiredFieldValidator id="rfvReleaseStateId" runat="server"
                                        ControlToValidate="ddlReleaseStateId"
                                        ErrorMessage=" * Release state is a required field."
                                        ForeColor="Red"/>
        </p>
        <p>
            <asp:Label ID="lblReleasePlanEstimate" runat="server" AssociatedControlID="txtReleasePlanEstimate">Plan estimate:</asp:Label>
            <asp:TextBox ID="txtReleasePlanEstimate" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RangeValidator id="revReleasePlanEstimate" runat="server"
                                        ControlToValidate="txtReleasePlanEstimate"
                                        MinimumValue="0"
                                        MaximumValue="2147483647"
                                        Type="Integer"
                                        Text="Release Plan estimate must be integer and greater or equal than 0"/>
        </p>
        <asp:Button ID="btnCreateUpdate" runat="server" Text="Save" OnCommand="OnButtonCommand" CommandName="SaveUpdate"/>
        
        <asp:GridView ID="grdIterations" runat="server" AutoGenerateColumns="false" Visible="false">
            <columns>
                <asp:BoundField HeaderText="ID" DataField="Id" />
                <asp:BoundField HeaderText="Project" DataField="Project" />
                <asp:BoundField HeaderText="Start Date" DataField="Start_date" />
                <asp:BoundField HeaderText="End Date" DataField="End_date" />
                <asp:BoundField HeaderText="State" DataField="State" />
                <asp:BoundField HeaderText="Plan Estimate" DataField="Plan_estimate" />
                <asp:BoundField HeaderText="Release" DataField="Release_id" />
            </columns>
        </asp:GridView>

    </div>
</asp:Content>
